package test;

import java.io.BufferedWriter;
import java.io.IOException;

import table.LatexTable;
import table.LatexTable.Alignment;
import table.LatexTable.Borders;
import table.LatexTable.Formats;
import table.LatexTable.Placement;

public class run {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		Alignment alignments[] = {Alignment.Center, Alignment.Width.setWidth(5.0)};
		LatexTable table = new LatexTable(2,2, Borders.All, alignments, true);
				
		table.setHeader(0, "day");
		table.setHeader(1, "temp");
		table.setCaption("caption test");
		table.setLabel("labeltest");
		
		table.setUnitCol(1, " C");
		table.setFormatCol(0, Formats.String);
		table.setFormatCol(1, Formats.Float, 1);
		
		Object data[][] = {
				{"Monday", new Double(27.5253253252)},
				{"Tuesday", new Double(22.5325325325)}				
		};
		
		Object data_cols[][] = {
				{"Monday", "Tuesday"},
				{new Double(27.5253253252), new Double(22.5325325325)}				
		};
		
		double ds[] = {27.5253253252, 22.5325325325};
		String strs[] = {"Monday", "Tuesday"};
		
//		for(int r=0; r<2; r++)
//			table.addToRow(r, data[r]);
		
//		for(int c=0; c<2; c++)
//			table.addToCol(c, data_cols[c]);
		
//		table.addToTable(data);
		
		table.addToCol(0, strs);
		table.addToCol(1, ds);
		
//		table.addToRowCol(0, 0, "Monday");
//		table.addToRowCol(0, 1, "27.5253253252");
//		table.addToRowCol(1, 0, "Tuesday");
//		table.addToRowCol(1, 1, "22.5325325325");
		
		table.addPlacement(Placement.Here, true);
		BufferedWriter out = LatexTable.openForWriting("test.txt");
		try {
			table.writeToDisk(out);
		} catch (IOException e) {		
			e.printStackTrace();
		}
	}

}
